<template>
    <div class="xl-table">
        <div class="xl-table-content">
            <xlTable
                    :queryParam="queryParam"
                    :columns="columns"
                    :dataSource="data"
                    rowKey="id"
                    :pagination="pagination"
                    :loading="loading"
                    @change="handleTableChange"
                    bordered
                    :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}">
                >
                <template v-slot:action="scope">
                    <a @click="(e)=>{
                            e.target.style.color='#999'
                            seeForm(scope.record)
                        }">查看</a>
                </template>
            </xlTable>
        </div>
        <xlForm :column="2" ref="xlForm" @handleOk="handleOk"></xlForm>
        <seeForm ref="seeForm"></seeForm>
    </div>
</template>

<script>

    import xlMixin from '../../../components/mixin/index'
    export default {
        name: "index",
        mixins:[xlMixin],
        data(){
            return{
                columns:[
                    {
                        title: '序号',
                        key: 'rowIndex',
                        align: "center",
                        fixed: 'left',
                        width:'100px',
                        sorter: (a) => a.id,//排序
                        customRender: function (t, r, index) {
                            return parseInt(index) + 1;
                        }
                    },
                    {
                        title: '活动名称',
                        dataIndex: 'activityName',
                        type:'input'
                    },
                    {
                        title: '活动日期',
                        dataIndex: 'activityDate',
                        type:'date'
                    },
                    {
                        title: '活动类型',
                        dataIndex: 'activityType',
                        type:'input',
                        required:false
                    },
                    {
                        title: '参加人数',
                        dataIndex: 'paticipateNum',
                        type:'input.number',
                        required:false
                    },
                    {
                        title: '活动日程描述',
                        dataIndex: 'durationTime',
                        type:'textarea',
                        span:2
                    },
                    {
                        title: '附件',
                        dataIndex: 'materialPath',
                        type:'upload.file',
                        tableVisible:true,
                        required:false,
                        fileTitle:{
                            titleVisible:true,
                            title:"活动内容及相关现场照片"
                        },
                        span:2
                    },
                    {
                        title: '操作',
                        dataIndex: 'action',
                        align: "center",
                        fixed: 'right',
                        width:'150px',
                        scopedSlots: {customRender: 'action'},
                    }
                ],
                url: {
                    list: "/carrier/api/carrierActivity/pageList",
                    add: '/carrier/api/carrierActivity/add',
                    edit: '/carrier/api/carrierActivity/update',
                    delete: "/carrier/api/carrierActivity/remove",
                    deleteBatch: "/carrier/api/carrierActivity/remove",
                    exportXlsUrl: "/carrier/api/carrierActivity/exportExcel",
                    importExcelUrl: "/carrier/api/carrierActivity/importExcel",
                    importExcelDemoUrl: "/carrier/api/carrierActivity/importTemplate"
                }
            }
        },
        props:{
            carrierId:Number,
            filterYear:String
        },
        created(){
            this.queryParam.carrierId = this.carrierId
            this.queryParam.filterYear = this.filterYear
            this.formatMerge()
            this.pageOnload()
        },
        watch:{
            carrierId(){
                this.queryParam.carrierId = this.carrierId
                this.queryParam.filterYear = this.filterYear
                this.pagination.current = 1
                this.pageOnload()
            },
            filterYear(){
                this.queryParam.carrierId = this.carrierId
                this.queryParam.filterYear = this.filterYear
                this.pagination.current = 1
                this.pageOnload()
            }
        }
    }
</script>

<style scoped lang="less">
    .xl-table{
        .xl-table-content{
            padding: 16px;
        }
    }
</style>
